package fr.uniscol.siecle.dao;

import java.sql.Types;

import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.SqlParameter;
import org.springframework.jdbc.core.SqlTypeValue;
import org.springframework.jdbc.object.StoredProcedure;

import fr.uniscol.model.BaseAnneeScolaire;

public class SynchroniserNomenclaturesStoredProcedure extends StoredProcedure {

	public static final String nom = "sync_nomenclatures";
	
	public SynchroniserNomenclaturesStoredProcedure(JdbcTemplate jdbcTemplate) {
		super(jdbcTemplate, nom);
		
		declareParameter(new SqlParameter("_etablissementid", Types.INTEGER, "INT"));
		declareParameter(new SqlParameter("_annee", Types.INTEGER, "INT"));
		
		compile();
	}
	
	public void synchroniser(BaseAnneeScolaire base){
		
		execute(base.getEtablissement().getId(), base.getAnnee());
	}
}
